//
//  ByBasketBallListVC.m
//  caipiao_ios
//
//  Created by mc on 2018/8/20.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByBasketBallListVC.h"
#import "ByBallFooterView.h"
#import "ByTootBallPopTitleView.h"
#import "ByFootBallBetVC.h"
#import "ByBasketBalllListValueView.h"
#import "ByFootBallListBottomView.h"
#import "ByFootBallWayTimesView.h"
#import "ByFootBallStandardPassView.h"
#import "ByDocumentaryCreateVC.h"
#import "ByBonusOptimizeVC.h"
#import "ByFootBallTitleValueView.h"


@interface ByBasketBallListVC ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) ByBallFooterView *footView;
@property (nonatomic, strong) ByFootBallListBottomView *bottomView;
@property (nonatomic, strong) ByFootBallWayTimesView *wayTimesView;
@property (nonatomic, strong)UIButton  *   maskView;// 背景
@property (nonatomic, assign) NSInteger count;
@property (nonatomic, strong) NSMutableArray *selectedArray;


@property (nonatomic, strong) ByPayBombView *payBombView;

@property (nonatomic, strong) ByNetModel *orderModel;

@end

@implementation ByBasketBallListVC

- (ByPayBombView *)payBombView{
    if (_payBombView == nil) {
        _payBombView = [[ByPayBombView alloc] init];
        
        __weak typeof(self) weakSelf = self;
        _payBombView.sureBlock = ^(){
            [weakSelf.payBombView remove];
            weakSelf.payBombView = nil;
            [weakSelf by_normalPopVC:@""];
        };
        
        _payBombView.otherSureBlock = ^(NSString *str,NSInteger type){
            
            [weakSelf.payBombView remove];
            weakSelf.payBombView = nil;
            
            if (type == 1) {
                ByWebViewController *vc = [[ByWebViewController alloc] initWithTotalUrlString:str];
                vc.titleString = @"支付宝支付";
                [weakSelf by_normalPush:vc hasNavi:YES];
            }else{
                ByWechatPayQrView *vc = [[ByWechatPayQrView alloc] init];
                vc.title = @"微信支付";
                vc.str = str;
                [weakSelf by_normalPush:vc hasNavi:YES];
            }
            
        };
        
        
        _payBombView.selectBlock = ^(NSInteger index){
            
        };
    }
    return _payBombView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.count = [ByFootBallHandle getBasketBallCountWithSelectedCount:_dataArray.count withNumber:_dataArray.count withArray:_dataArray];
    
    
    [self addLeftBackBarButtonItem];
    if (self.type == 0) {
        self.title = @"混合投注";
    }else if (self.type == 1){
        self.title = @"胜负";
    }else if (self.type == 2){
        self.title = @"让胜负";
    }else if (self.type == 3){
        self.title = @"大小分";
    }else if (self.type == 4){
        self.title = @"胜负差";
    }
    
    [self initViews];
    
    
    self.selectedArray = [NSMutableArray arrayWithCapacity:1];
    [self.selectedArray addObject:@(self.dataArray.count)];
    // Do any additional setup after loading the view.
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
    
    [self setNaviAttributeWithTranslucent:YES stateBarLightContent:NO];
}
- (void)initViews{
    
    UIImageView *backgroudView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, STATUS_NAV + 85)];
    backgroudView.image = [UIImage imageNamed:@"tixianbeijing"];
    [self.view addSubview:backgroudView];
    backgroudView.userInteractionEnabled = YES;
    
    UIButton *addEditBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [backgroudView addSubview:addEditBtn];
    [addEditBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroudView).offset(46);
        make.right.equalTo(backgroudView).offset(-46);
        make.bottom.equalTo(backgroudView).offset(-21);
        make.height.mas_equalTo(@30);
    }];
    addEditBtn.backgroundColor = rgba(234, 83, 87, 1);
    [addEditBtn setTitle:@"+ 添加/编辑比赛预测" forState:UIControlStateNormal];
    [addEditBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [addEditBtn addTarget:self action:@selector(addOrEditAction:) forControlEvents:UIControlEventTouchUpInside];
    addEditBtn.titleLabel.font = FONT(14);
    addEditBtn.layer.cornerRadius = 5;
    
    
    
    self.view.backgroundColor = BY_BACKGROUND_COLOR;
    self.tableView = [[UITableView alloc] init];
    self.tableView.backgroundColor = BY_BACKGROUND_COLOR;
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(0);
        make.right.equalTo(self.view).offset(0);
        make.top.equalTo(backgroudView.mas_bottom).offset(20);
        
        if (@available(ios 11.0,*)) {
            make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-145);
        } else {
            make.bottom.equalTo(self.view).offset(-145);
        }
    }];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    ByBallFooterView *footView = [[ByBallFooterView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40 + 35 + 10)];
    self.tableView.tableFooterView = footView;
    footView.deleteBlock = ^(){
        
        self.count = 1;
        [self.selectedArray removeAllObjects];
        
        [self.dataArray removeAllObjects];
        [self.tableView reloadData];
        if (self.dataArray.count == 0) {
            self.footView.hidden = YES;
        }
        [self updateBottomState];
    };
    self.footView = footView;
    if (self.dataArray.count == 0) {
        self.footView.hidden = YES;
    }
    
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, (SCREEN_WIDTH - 16) / 684.4 * 15)];
    UIImageView *topView = [[UIImageView alloc] init];
    [headView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headView).offset(8);
        make.right.equalTo(headView).offset(-8);
        make.top.equalTo(headView).offset(0);
        make.height.mas_equalTo(@10);
    }];
    topView.image = [UIImage imageNamed:@"touzhudanbeijingshang"];
    self.tableView.tableHeaderView = headView;
    
    ByFootBallListBottomView *bottomView = [[ByFootBallListBottomView alloc] init];
    [self.view addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(0);
        make.right.equalTo(self.view).offset(0);
        make.top.equalTo(self.tableView.mas_bottom).offset(50);
        make.height.mas_equalTo(@(50 + 45));
    }];
    bottomView.isBasketBall = NO;
    bottomView.documentaryBlock = ^(){
        
        [self handleResultWithIsBet:1];
        
    };
    
    bottomView.bonusBlock = ^(){
    
        //测试app
        if ([APP_SCHEME isEqualToString:@"rrgc.8raw.com"]) {
            [self handleResultWithIsBet:2];
        }else{
             [ByCoreToolAlert showOnlyText:@"正在升级中，敬请期待..."];
        }
    };
    
    
    bottomView.sureBlock = ^(){
        
        [self handleResultWithIsBet:0];
    };
    
    self.bottomView = bottomView;
    
    ByFootBallWayTimesView *wayTimesView = [[ByFootBallWayTimesView alloc] init];
    [self.view addSubview:wayTimesView];
    [wayTimesView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(0);
        make.right.equalTo(self.view).offset(0);
        make.bottom.equalTo(bottomView.mas_top).offset(0);
        make.height.mas_equalTo(@50);
    }];
    wayTimesView.addMinusView.updateBlock = ^(){
        [self updateBottomState];
    };
    
    
    __weak typeof(self) weakSelf = self;
    __weak typeof(ByFootBallWayTimesView *) weakSelfView = wayTimesView;
    wayTimesView.playWayBlock = ^(){
        
        if (self.dataArray.count == 0) {
            return ;
        }
        
        if (self.dataArray.count == 1 ) {
            if ([ByBasketBallHandle hasSingleWithArray:self.dataArray]) {
                
            }else{
                return;
            }
        }
        
        [self.view addSubview:self.maskView];
        [self.maskView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.view).offset(0);
            make.right.equalTo(self.view).offset(0);
            make.top.equalTo(self.view).offset(0);
            make.bottom.equalTo(self.bottomView.mas_top).offset(0);
        }];
        
        CGFloat height = 0;
        
        if (weakSelf.dataArray.count == 0) {
            height = 50;
        }else if (weakSelf.dataArray.count > 0 && weakSelf.dataArray.count < 5){
            height = 100;
        }else{
            height = 145;
        }
        
        ByFootBallWayTimesView *wayTimesView1 = [[ByFootBallWayTimesView alloc] init];
        [self.maskView addSubview:wayTimesView1];
        [wayTimesView1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.maskView).offset(0);
            make.right.equalTo(self.maskView).offset(0);
            make.bottom.equalTo(self.maskView).offset(-(height));
            make.height.mas_equalTo(@50);
        }];
        wayTimesView1.addMinusView.countLabel.text = weakSelfView.addMinusView.countLabel.text;
        
        __weak typeof(ByFootBallWayTimesView *) weakSelfView1 = wayTimesView1;
        wayTimesView1.addMinusView.updateBlock = ^(){
            self.wayTimesView.addMinusView.countLabel.text = weakSelfView1.addMinusView.countLabel.text;
            [self updateBottomState];
        };
        
        
        wayTimesView1.playWayBlock = ^(){
            
            [self.maskView removeFromSuperview];
            self.maskView = nil;
        };
        
        ByFootBallStandardPassView *standardView = [[ByFootBallStandardPassView alloc] init];
        standardView.isBasketBall = YES;
        [self.maskView addSubview:standardView];
        [standardView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.maskView).offset(0);
            make.right.equalTo(self.maskView).offset(0);
            make.bottom.equalTo(self.maskView).offset(0);
            make.top.equalTo(wayTimesView1.mas_bottom).offset(0);
        }];
        standardView.selectedArray = weakSelf.selectedArray;
        standardView.dataArray = weakSelf.dataArray;
        standardView.selectBlock = ^(NSInteger count,NSMutableArray *selectedArray){
            weakSelf.count = count;
            weakSelf.selectedArray= selectedArray;
            [weakSelf updateBottomState];
        };
    };
    self.wayTimesView = wayTimesView;
    [self updateBottomState];
    
}

- (void)handleResultWithIsBet:(NSInteger)type{
    
    if (!self.footView.selectBtn.selected) {
        [ByCoreToolAlert showOnlyText:@"必须阅读并同意协议"];
        return;
    }
    
    if (self.dataArray.count == 1) {
        
        
        ByNetModel *netModel = [self.dataArray firstObject];
        NSArray *selectedArray1 = netModel.sfSelectedArray;
        NSArray *selectedArray2 = netModel.rsfSelectedArray;
        NSArray *selectedArray3 = netModel.bigSmallSelectedArray;
        NSArray *selectedArray4 = netModel.sfcSelectedArray;
        
        ByNetModel *onlyModel;
        if (selectedArray1.count > 0) {
            onlyModel = [selectedArray1 firstObject];
        }else if (selectedArray2.count > 0){
            onlyModel = [selectedArray2 firstObject];
        }else if (selectedArray3.count > 0){
            onlyModel = [selectedArray3 firstObject];
        }else if (selectedArray4.count > 0){
            onlyModel = [selectedArray4 firstObject];
        }
        
        BOOL value1 = [ByFootBallHandle oneGameIsOnlyHasSinglePass:[selectedArray1 copy]];
        BOOL value2 = [ByFootBallHandle oneGameIsOnlyHasSinglePass:[selectedArray2 copy]];
        BOOL value3 = [ByFootBallHandle oneGameIsOnlyHasSinglePass:[selectedArray3 copy]];
        BOOL value4 = [ByFootBallHandle oneGameIsOnlyHasSinglePass:[selectedArray4 copy]];
        
        
        if (value1 && value2 && value3 && value4) {
            
        }else{
            [ByCoreToolAlert showOnlyText:@"至少选择两场比赛"];
            return ;
        }
        
        
        
        if (onlyModel.single.integerValue > 0) {
            
            [ByCoreToolAlert showOnlyText:@"当前是单关"];
            
        }else{
            
            [ByCoreToolAlert showOnlyText:@"至少选择两场比赛"];
            return ;
            
        }
        
        
        
    }else{
        
        if (self.dataArray.count < 2) {
            
            [ByCoreToolAlert showOnlyText:@"至少选择两场比赛"];
            return ;
        }
        
    }
    
    
    if (self.count == 0) {
        [ByCoreToolAlert showOnlyText:@"请先选择过关方式"];
        return;
    }
    
    
    ByNetModel *netModel = [[ByNetModel alloc] init];
    netModel.numDic = [ByBasketBallHandle getBasketBallNumWithSelectedData:self.dataArray WithType:self.type];
    netModel.multiple = self.wayTimesView.addMinusView.countLabel.text;
    netModel.free_pass = [ByFootBallHandle getFootBallFreePassWithArray:self.selectedArray];
    netModel.selectedArray = [self.selectedArray copy];
    netModel.origin_numDic = netModel.numDic;
    netModel.count = self.count;
    if (netModel.free_pass.length == 0) {
        [ByCoreToolAlert showOnlyText:@"请先选择过关方式"];
        return;
    }
    if (type == 0) {
        [self BasketBallBetCheckWith:netModel];
        
    }else if (type == 1){
        
        if (self.maskView) {
            [self.maskView removeFromSuperview];
            self.maskView = nil;
        }
        NSInteger money =self.count * self.wayTimesView.addMinusView.countLabel.text.integerValue * 2;
        if (money < 100) {
            [ByCoreToolAlert showOnlyText:@"跟单金额不能小于100元"];
            return;
        }
        
        
        ByDocumentaryCreateVC *vc = [[ByDocumentaryCreateVC alloc] init];
        vc.isBasketBall = YES;
        vc.money = money;
        vc.netModel = netModel;
        vc.type = self.type;
        [self by_normalPush:vc hasNavi:YES];
        
    }else if (type == 2){
        
        
        ByBonusOptimizeVC *vc = [[ByBonusOptimizeVC alloc] init];
        vc.netModel = netModel;
        vc.selectedArray = self.dataArray;
        vc.type = self.type;
        [self by_normalPush:vc hasNavi:YES];
        
    }
}



- (void)BasketBallBetCheckWith:(ByNetModel *)netModel1{
    [ByCoreToolAlert showLoadind:@"投注处理中" hasMasker:YES];
    [ByBallApi BasketBallVerify:netModel1 success:^(ByNetBaseResult *result) {
        
        [ByCoreToolAlert hideHud];
        SLog(@"篮球校验 = %@", result.data);
        NSDictionary *dictionary = result.data[@"data"];
        
        NSMutableArray *numArray = [NSMutableArray array];
        for (NSDictionary *dic in dictionary[@"list"]) {
            ByNetModel *netModel = [[ByNetModel alloc] initContentWithDic:dic];
            NSMutableDictionary *dataNum = [NSMutableDictionary dictionary];
            [dataNum setObject:[NSString stringWithFormat:@"%.2f",netModel.bonus.floatValue] forKey:@"bonus"];
            [dataNum setObject:netModel.content forKey:@"content"];
            [dataNum setObject:@"1" forKey:@"multiple"];
            [dataNum setObject:netModel.pass_type forKey:@"pass_type"];
            [dataNum setObject:netModel.strung forKey:@"strung"];
            [numArray addObject:dataNum];
        }
        
        [ByCoreToolAlert showLoadind:@"投注处理中" hasMasker:YES];
        netModel1.order_type = @"smart";
        netModel1.numArray = numArray;
        [ByBallApi basketBallOptimizationCreateOrder:netModel1 success:^(ByNetBaseResult *result) {
            [ByCoreToolAlert hideHud];
            NSLog(@"足球投注 = %@", result.data);
            self.orderModel = [[ByNetModel alloc] initContentWithDic:result.data[@"data"]];
            self.payBombView.moneyLabel.text = [NSString stringWithFormat:@"%@元", self.orderModel.amount];
            self.payBombView.orderModel = self.orderModel;
            [self.payBombView show];
        } failure:^(ByNetBaseResult *result) {
            [ByCoreToolAlert showOnlyText:result.msg];
        }];
        
        
    } failure:^(ByNetBaseResult *result) {
        [ByCoreToolAlert showFailureWithText:result.msg];
    }];
}



- (UIButton *)maskView{
    if (_maskView == nil) {
        _maskView = [UIButton buttonWithType:UIButtonTypeCustom];
        _maskView.backgroundColor = [UIColor colorWithRed:100/255.0 green:100/255.0 blue:100/255.0 alpha:0.2];
        [_maskView addTarget:self action:@selector(maskAction:) forControlEvents:UIControlEventTouchUpInside];
        
        
    }
    return _maskView;
}

- (void)maskAction:(UIButton *)btn{
    
    [_maskView removeFromSuperview];
    _maskView = nil;
}


- (void)updateBottomState{
    
    if (self.dataArray.count == 0) {
        self.bottomView.moneyLabel.text = @"0元";
        self.bottomView.otherLabel.text = @"0注1倍";
    }else{
        
        self.bottomView.otherLabel.text = [NSString stringWithFormat:@"%ld注%@倍",self.count, self.wayTimesView.addMinusView.countLabel.text];
        self.bottomView.moneyLabel.text = [NSString stringWithFormat:@"%ld元", self.count * self.wayTimesView.addMinusView.countLabel.text.integerValue * 2];
        
    }
}


- (void)leftItemsAction:(NSInteger)leftIndex {
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
    //用于处理删除 后上个页面的刷新
    NSString *str =  [ByFootBallHandle getCurrentSelectedGameIDStringWithArray:self.dataArray];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshBasketBallData" object:str];
}


- (void)addOrEditAction:(UIButton *)btn{
    [self leftItemsAction:0];
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
        
        UILabel *line = [[UILabel alloc] init];
        [cell addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(cell).offset(0);
            make.right.equalTo(cell).offset(0);
            make.bottom.equalTo(cell).offset(0);
            make.height.mas_equalTo(@1);
        }];
        line.backgroundColor = BY_LINE_COLOR;
    }
    
    for (UIView *view in cell.contentView.subviews) {
        [view removeFromSuperview];
    }
    
    cell.contentView.backgroundColor = BY_BACKGROUND_COLOR;
    
    ByNetModel *netModel = [self.dataArray objectAtIndex:indexPath.row];
    UIView *backgroundView = [[UIView alloc] init];
    [cell.contentView addSubview:backgroundView];
    [backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(cell.contentView).offset(18);
        make.right.equalTo(cell.contentView).offset(-18);
        make.top.equalTo(cell.contentView).offset(0);
        make.bottom.equalTo(cell.contentView).offset(-1);
    }];
    backgroundView.backgroundColor = [UIColor whiteColor];
    
    
    UILabel *titleLabel = [[UILabel alloc] init];
    [backgroundView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(0);
        make.top.equalTo(backgroundView).offset(10);
        make.height.mas_equalTo(@15);
        make.right.equalTo(backgroundView).offset(0);
    }];
    titleLabel.text = [NSString stringWithFormat:@"%@截止", netModel.netModel.b_date];
    titleLabel.font = FONT(14);
    titleLabel.textColor = [UIColor lightGrayColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    
    ByTootBallPopTitleView *titleView = [[ByTootBallPopTitleView alloc] init];
    [backgroundView addSubview:titleView];
    [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(0);
        make.right.equalTo(backgroundView).offset(0);
        make.top.equalTo(titleLabel.mas_bottom).offset(0);
        make.height.mas_equalTo(@40);
    }];
    titleView.isBasketBall = YES;
    titleView.netModel = netModel.netModel;
    titleView.line.hidden = YES;
    
    
    UIButton *deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [backgroundView addSubview:deleteBtn];
    [deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(10);
        make.top.equalTo(titleView.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(20, 20));
    }];
    [deleteBtn setImage:[UIImage imageNamed:@"shanchu投注单"] forState:UIControlStateNormal];
    deleteBtn.tag = 100 + indexPath.row;
    [deleteBtn addTarget:self action:@selector(deleteBtn:) forControlEvents:UIControlEventTouchUpInside];
    
    ByBasketBalllListValueView *valueView = [[ByBasketBalllListValueView alloc] init];
    [backgroundView addSubview:valueView];
    [valueView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(deleteBtn.mas_right).offset(15);
        make.right.equalTo(backgroundView).offset(-15);
        make.top.equalTo(titleView.mas_bottom).offset(0);
        make.bottom.equalTo(backgroundView).offset(-15);
    }];
    valueView.type = self.type;
    valueView.netModel = netModel;
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    ByNetModel *netModel = [self.dataArray objectAtIndex:indexPath.row];
    CGFloat height = 25 + 40 + 15;
    if (self.type == 0) {
        
        height = height + 20;
        height = height +  [ByFootBallTitleValueView  getHeightWithDataString:netModel.selectedSfString];
        height = height +  [ByFootBallTitleValueView  getHeightWithDataString:netModel.selectedRsfString];
        height = height +  [ByFootBallTitleValueView  getHeightWithDataString:netModel.selectedBigSmallString];
        height = height +  [ByFootBallTitleValueView  getHeightWithDataString:netModel.sfcSelectedString1];
        height = height +  [ByFootBallTitleValueView  getHeightWithDataString:netModel.sfcSelectedString2];
        return height;
        
    }else if (self.type == 1 || self.type == 2 || self.type == 3){
        return 66 + 50 + 15;
    
    }else if (self.type == 4){
        
        height = height + 20;
        height = height +  [ByFootBallTitleValueView  getHeightWithDataString:netModel.sfcSelectedString1];
        height = height +  [ByFootBallTitleValueView  getHeightWithDataString:netModel.sfcSelectedString2];
        return height;
    }
    return  200;
}


- (void)deleteBtn:(UIButton *)btn{
    NSInteger index = btn.tag  - 100;
    [self.dataArray removeObjectAtIndex:index];
    
    
    self.count = [ByFootBallHandle getBasketBallCountWithSelectedCount:_dataArray.count withNumber:_dataArray.count withArray:_dataArray];
    [self.selectedArray removeAllObjects];
    [self.selectedArray addObject:@(self.dataArray.count)];
    
    [self.tableView reloadData];
    [self updateBottomState];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
